	
	$(function(){
	        $("#type").combobox({
				width : 100,
				panelHeight : 100,
				editable:false 
				
			});
	        $("#auditingState").combobox({
				width : 100,
				panelHeight : 100,
				editable:false 
				
			});
	    $("#searchid").linkbutton({
				text : '查询',
				iconCls : 'icon-search'
			});
			$('#table').datagrid({
				title:'资讯列表',
				width:1230,
				height:400,
				nowrap : false,
		        triped : true,
		        collapsible : false,
				idField : 'id',
				url:base+'/news/searchNewslist.shtml',
				frozenColumns:[[
	                {field:'ck',checkbox:true}
	                
				]],
				queryParams : {
			       type : '-1',
			       auditingState : '-1'
		        },
				columns:[[{
					title : '基本信息',
					colspan : 6
				}, {
					field : 'opt',
					title : '操作',
					align : 'center',
					width:100,
					rowspan : 2,
					formatter : function(value, rec) {
						if (rec.id == undefined)
							return null;
						else
							return '<span style="color:red"><span onclick=Onmodify("'
									+ rec.id
									+ '")><font style="cursor:pointer;color:blue;">查看</font></span> <span onclick=Ondelete("'
									+ rec.id + '")><font style="cursor:pointer;color:blue;">修改</font></span></span>';
					}
				}],[
					{field:'title',mapping:'title',title:'资讯标题',width:200,align : 'center'},
					{field:'name',title:'发布人',align : 'center',width:150,sortable:true},
					{field:'createTimeStr',title:'发布时间',align : 'center',width:150,sortable:true},
					{field:'isAuth',title:'审核状态',width:120,align : 'center',sortable:false,formatter : function(value, rec) {
					      if(value==0)return '未审核';
					      if(value==1)return '已审核';
					      if(value==2)return '审核未通过';
					}}
					
				]],
				pagination:true,
				rownumbers:true,
				toolbar:[{
					id:'btnadd',
					text:'新增',
					iconCls:'icon-add',
					handler:function(){
						$(this).attr("href", 'addIndustry.jsp');
					}
				},'-',{
					id:'btncut',
					text:'删除',
					iconCls:'icon-cut',
					handler:function(){
						var records = $('#table').datagrid("getSelections");
						var ids = '';
						if (null == records || records == "") {
							alert('请选择要删除的记录');
							return;
						}
						for (var i = 0; i < records.length; i++) {
							if (records[i].id == undefined
									|| records[i].id == "undefined") {

								alert('此条记录已不存在');
								return;
							}
							ids += records[i].id;
							ids += ',';
						}
							var url1 = base+'/sysmenu/deleteByIds.shtml';

						$.ajax({
									url : url1,
									data : "ids=" + ids,
									success : function(msg) {

										var obj = eval('(' + msg + ')');
										var result = obj[0]["message"];
										alert(result);
										$('#table').datagrid("reload");
									}
								});
					}
				},'-',
				{
					id:'btnadd',
					text:'审核',
					handler:function(){
						
					}
				}
				]
			});
			
		});
		
function onSearch() {
	var queryParams = $('#table').datagrid("options").queryParams;
	queryParams.type = $("#type").combobox("getValue");
	queryParams.auditingState = $("#auditingState").combobox("getValue");
	$('#table').datagrid("reload");
}
	
	
	
	

